package com.tang.sys.service.impl;

import com.tang.sys.ResponseResult;
import com.tang.sys.entity.SensitiveWord;
import com.tang.sys.mapper.SensitiveWordMapper;
import com.tang.sys.service.ISensitiveWordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author shankaka
 * @since 2023-05-04
 */
@Service
public class SensitiveWordServiceImpl extends ServiceImpl<SensitiveWordMapper, SensitiveWord> implements ISensitiveWordService {

    @Override
    public ResponseResult sensitive() {
        List<SensitiveWord> sensitiveWords = this.baseMapper.selectList(null);
        List<String> dirtyList = new ArrayList<>();
        for (SensitiveWord sensitiveWord : sensitiveWords) {
            dirtyList.add(sensitiveWord.getBadword());
        }
        Map<String, List<String>> resultMap = new HashMap<>();
        resultMap.put("dirtyList", dirtyList);
        return ResponseResult.okResult(resultMap);
    }
}
